package com.wangyadong.hobby.schedule.jobtask.gson;

import com.google.gson.Gson;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.HashMap;

/**
 * <p>
 *
 * @author <714037465@qq.com>
 * @since 2018/7/2413:57
 **/
public class TranslateJson {

    public static void main(String[] args) {
        String s = "{\n" +
                "\t\t\"departmentId\": 989771399433216001,\n" +
                "\t\t\"departmentName\": \"新管理层\"\n" +
                "\t}, {\n" +
                "\t\t\"departmentId\": 989771399433216003,\n" +
                "\t\t\"departmentName\": \"运营管理部\"\n" +
                "\t}";


        Gson gson = new Gson();
//        HashMap map = gson.fromJson(s, HashMap.class);
//        map.forEach((k, v) -> {
//            System.out.println("k = " + k + " value =" + v);
//        });
        System.out.println("========================================================");
        ArrayList<User> list = gson.fromJson(s, ArrayList.class);
        list.forEach(r -> {
            System.out.println("k = " + r);
        });
    }
}
